package cn.jy.careuplusdoctor.http;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.app.ProgressDialog;
import android.content.Context;
import cn.jy.careuplusdoctor.utils.BaseMultipartManager;
import cn.jy.careuplusdoctor.utils.Param;
import cn.jy.careuplusdoctor.utils.ProgressMultipartEntity.ProgressCallback;
import cn.jy.careuplusdoctor.utils.StringUtil;
import fay.frame.fast.F;
import fay.frame.fast.callback.AjaxCallback;
import fay.frame.fast.callback.AjaxStatus;

public class UploadManager extends BaseMultipartManager<String> {
	@Override
	protected String parseData(String jsonStr) {
		return rst(jsonStr);
	}

	/**
	 * 上传报读资料
	 * @param imgStr
	 * @param imgName
	 * @param FileFolder
	 * @param callback
	 * @param progressCallback
	 */
	public void upload(File imgStr, String imgName, String FileFolder,Callback<String> callback,
			ProgressCallback progressCallback) {
		
		if (imgStr == null) {
			return;
		}
		if (callback == null) {
			return;
		}
		List<Param> _params = new ArrayList<Param>();
		_params.add(new Param("imgStr", imgStr));
		_params.add(new Param("imgName",imgName));
		_params.add(new Param("FileFolder", FileFolder));
		setMultipartParams(_params);
		setMultipart(true);
		setCallback(callback);
		if (progressCallback != null) {
			setProgressCallback(progressCallback);
		}
		setUrl(HttpUrls.URL_UPLOAD);
		execute();
	}

	

	public String rst(String jsonStr) {
		/*String _rst = "";
		try {
			JSONObject _json = new JSONObject(jsonStr);
			_rst = getJsonValue(_json, "");
		} catch (JSONException e) {
			e.printStackTrace();
		}*/
		return jsonStr;
	}
}
